package org.sy.lab.Java7并发编程实战.六并发集合.二使用阻塞式线程安全列表;

import java.util.Date;
import java.util.concurrent.LinkedBlockingDeque;

public class Main {
	public static void main(String[] args) throws Exception {
		LinkedBlockingDeque<String> list = new LinkedBlockingDeque<>(3);
		Client client = new Client(list);
		Thread thread = new Thread(client);
		thread.start();
		for(int i=0; i<5; i++) {
			for(int j=0; j<3; j++) {
				String request = list.take();
				System.out.printf("Main: Request: %s at %s. Size: %d\n", request, new Date(), list.size());
			}
		}
		System.out.printf("Main: End of the program.\n");
	}
}
